var now = getDay(0);
var username = sessionStorage.getItem("name");
var userid = sessionStorage.getItem("userId");
var searchtype ="";
var trStr;
$(document).ready(function(){
	$('#time').append(now);
	$('#searchButton').on('click',function(){
		if($('#shopcode').val()== "" || $('#shopcode').val()==undefined){
			alert("名称不能为空")
		}else{
			$("#data").text('');
			getData();
		}
	});
});
function getData(){
	$.ajax({
		url: '../../repair_info/maintain'
		,type:'post'
		,dataType:'json'
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({'shopcode':$('#shopcode').val()})  
		,success: function(res){
			console.log(res);
			for (var i = 0; i < res.data.length; i++) {
					trStr += '<tr class="thin-border-bottom">'
							+'	<td class="" >'+res.data[i].plan+'</span></td>'//onclick = "detail(\''+res.data[i].id+'\')"
							+'	<td>'+(Number(res.data[i].cost_parts==""?0:res.data[i].cost_parts)+Number(res.data[i].cost_worker==""?0:res.data[i].cost_worker))+'</td>'
							+'	<td>'+res.data[i].warranty+'</td>'
							+'</tr>'
			}
			$('#data').append(trStr);
			trStr ="";
		}
	});
}
function detail(id){	
	var url  = "../../mobile_page/baoxiu/baoxiu_weixiu_search?id="+id;//此处拼接内容
	window.location.href = url;
}	